<?php 
## include required files
/*******************************/
require_once '../model/moduleuser.php';
/*******************************/
## Create Objects
/*******************************/
/*******************************/
$moduleObj = new Model_ModuleUser();
/*******************************/

if($_GET['id']!=''&& $_GET['action']=='edit') {
	$module_id=base64_decode($_GET['id']);
	$smarty->assign('page', $_GET['page']);
	$moduleArray=$moduleObj->getModuleHelpText($module_id);
	$smarty->assign('moduleArray', $moduleArray);
	
}
if(isset($_POST['edithelp_btn'])) {
	## apply PHP validation for required filed
	if(trim($_POST['module_help_text']) != '') {
		$moduleArray = array();
		extract($_POST);
		$moduleArray['module_help_text']   = return_post_value($module_help_text);
		$moduleObj->editModuleHelpTextById($moduleArray,$_POST['module_id']);
		$_SESSION['msg']="<div class='success_msg'><span>CMS Help text updated successfully!</span></div>";
		header('location:'.SITE_URL.'/admin/home.php?q=helptext&page='.$_POST['page']);
		exit;
		
	} else {// php validation else
		$_SESSION['msg']="<div class='error_msg'><span>Please enter the cms help text</span></div>";
	}
	// main if closed
}

## Assign success or error msg to smarty variable and unset session variable
if(trim($_SESSION['msg']) != '') {
	$smarty->assign('msg', $_SESSION['msg']);
	unset($_SESSION['msg']);
}


## Unset all the objects created which are on this page
unset($moduleObj);

$smarty->display(TEMPLATEDIR_ADMIN. 'settings/edithelptext.tpl');
unset($smarty);
?>